package com.example.audiostreaming.base;


import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.fragment.app.FragmentActivity;

import com.example.audiostreaming.R;

/**
 * Activity活动父类
 */
public class BaseActivity extends FragmentActivity {
    private ImageView mIvBack;
    private TextView mTvTitle;

    protected void initNavBar(boolean isShowBack, String title){
        mIvBack = findViewById(R.id.iv_back);
        mTvTitle = findViewById(R.id.tv_title);

        mIvBack.setVisibility(isShowBack? View.VISIBLE:View.GONE);
        mTvTitle.setText(title);

        mIvBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });
    }
}
